/*
 * PitchAmplitude.java
 *
 * Copyright (c) 2010 Jaymie Strecker (strecker at cs.umd.edu). All rights reserved.
 *
 * This file is part of Tonic.
 *
 * Tonic is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Tonic is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tonic.  If not, see <http://www.gnu.org/licenses/>.
 */

package tonic.audio;

/**
 *
 * @author Jaymie Strecker (strecker at cs.umd.edu)
 */
public class PitchAmplitude {
    public Pitch pitch;
    public double amplitude;

    public PitchAmplitude(Pitch pitch, double amplitude) {
        this.pitch = pitch;
        this.amplitude = amplitude; 
    }

    @Override
    public boolean equals(Object o) {
        if (! (o instanceof PitchAmplitude)) {
            return false;
        } else {
            PitchAmplitude other = (PitchAmplitude) o;
            return other != null && pitch.equals(other.pitch) && amplitude == other.amplitude;
        }
    }

    @Override
    public int hashCode() {
        String s = Integer.toString(pitch.number()) + Double.toString(amplitude);
        return s.hashCode();
    }

}
